﻿<UserControl x:Class="RLProject1.View.GridFieldView"
             Name="GridField"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:src_vm="clr-namespace:RLProject1.ViewModel"
             xmlns:src_vmh="clr-namespace:RLProject1.ViewModel.Helper"
             mc:Ignorable="d" 
             d:DesignHeight="75" d:DesignWidth="75" Background="Bisque" BorderThickness="1" BorderBrush="Black"
             MaxHeight="90" MaxWidth="90" MinWidth="90" MinHeight="90">
    <UserControl.Resources>
        <src_vmh:StringActionToAngelConverter x:Key="angelConverter" />
        <src_vmh:BoolToVisibilityConverter x:Key="visibilityConverter" />
        <ItemsPanelTemplate x:Key="qPanel">
            <UniformGrid Rows="3" Columns="3" />
        </ItemsPanelTemplate>
    </UserControl.Resources>
    
    <Grid>
        <Image Source="/RLProject1;component/Images/RobotAMEE.png" Visibility="{Binding Occupied, Converter={StaticResource visibilityConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="36" />
        <!-- Richtungspfeil -->
        <Canvas Name="Arrow" Visibility="{Binding ShowArrow, Converter={StaticResource visibilityConverter}}" Width="30" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Line X1="15" Y1="15" Stroke="{Binding ArrowBrush}" StrokeThickness="2"/>
            <Line X2="9" Y2="5" Stroke="{Binding ArrowBrush}"/>
            <Line X2="5" Y2="9" Stroke="{Binding ArrowBrush}"/>
            <Canvas.RenderTransform>
                <RotateTransform x:Name="ArrowRotator" CenterX="17" CenterY="17" Angle="{Binding LastUpdated, Converter={StaticResource angelConverter}}" />
            </Canvas.RenderTransform>
        </Canvas>
        <!-- <UniformGrid Rows="3" Columns="3" > -->
        <ItemsControl ItemsSource="{Binding QValues}" ItemsPanel="{StaticResource qPanel}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Label Content="{Binding Value}" Foreground="{Binding Color}" HorizontalContentAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="{Binding VAlignment}" FontSize="9"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        <!-- </UniformGrid> -->
    </Grid>
</UserControl>
